package com.hyt.it.ogt.kq.common.gov.enums;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * @PACKAGE_NAME: com.hyt.it.ogt.kq.common.gov.enums
 * @USER: Wuyingge
 * @DATE: 2023/8/8 09:30
 * @PROJECT_NAME: it-ogt-kq
 * @Desc : 科目导入考场类型
 *
 **/
public enum SubjectImportExamTypeEnums {

    BOOK(1, "纸笔考场","ZZZZZZZZZZA141739346474065922984"),
    PC(2, "计算机考场","ZZZZZZZZZZA141739346469871616138"),
    LISTING(3, "听力考场","ZZZZZZZZZZA141739346474065122985"),
    OTHER(4, "其他考场","ZZZZZZZZZZA141739336474065522986"),
    ;


    private final Integer type;
    private final String desc;

    private final String id;

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public String getId() {
        return id;
    }

    SubjectImportExamTypeEnums(Integer type, String desc, String id) {
        this.type = type;
        this.desc = desc;
        this.id = id;
    }

    public static List<SubjectImportExamTypeEnums> getAll(){
        return Arrays.stream(SubjectImportExamTypeEnums.values()).collect(Collectors.toList());
    }

    public static Optional<SubjectImportExamTypeEnums> getByCode(Integer code){
        return Arrays.stream(SubjectImportExamTypeEnums.values()).filter(e -> Objects.equals(code,e.getType())).findFirst();
    }

    public static Optional<SubjectImportExamTypeEnums> getByDesc(String desc){
        return Arrays.stream(SubjectImportExamTypeEnums.values()).filter(e -> Objects.equals(desc,e.getDesc())).findFirst();
    }

    public static Optional<SubjectImportExamTypeEnums> getById(Integer id){
        return Arrays.stream(SubjectImportExamTypeEnums.values()).filter(e -> Objects.equals(id,e.getId())).findFirst();
    }
}
